package dongshi.daddy.huohuo.eventbus.subscribe;

import com.google.common.eventbus.Subscribe;
import dongshi.daddy.huohuo.eventbus.event.CustomEvent;

import java.time.Instant;

/**
 * @desc 事件监听 1
 **/
public class Subscriber1 {
    @Subscribe
    public void test1(CustomEvent event) {
        System.out.println(Instant.now() + "监听者1-->回调1,收到事件：" + event.getData() + "，线程号为：" + Thread.currentThread().getName());
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Subscribe
    public void test2(CustomEvent event) {
        System.out.println(Instant.now() + "监听者1-->回调2,收到事件：" + event.getData() + "，线程号为：" + Thread.currentThread().getName());
    }
}
